<?php

/**
 *		会员中心
 *		2012年5月31日13:48:07 
 *		袁吉
 */
class MemberAction extends CommonAction {
    public function index() {
		$Member = D('Member');
		$Member->getModelName();
        $this->display();
    }
	#会员登录
	public function login(){
		if($_POST){
			$MemberModel	= D('Member');
			$user_name		= trim($_POST['username']);
			$password		= trim($_POST['password']);
			if(empty($user_name)){
				$this->error('用户名不能为空');
			}
			if(empty($password)){
				$this->error('密码不能为空');
			}
			
			$reg = $MemberModel->login($user_name,$password,$_POST['jizhumima']);
			if($reg===1){
				//$this->success('登录成功！');exit;
				$this->redirect('/');
			}elseif($reg===2){
				$this->error('用户名不存在！');
			}else{
				$this->error('用户名或者密码错误！');
			}
			
		}
		$this->display();
	}
	#会员注册
	public function register(){
		$this->display();
	}
	#退出登录
	public function logout(){
		$Member = D('Member');
		//session(NULL);
		$Member->logout();
		//$this->redirect("bizi://Home-Index/");
		$this->redirect("Index/index");
	}
	#网站收藏
	public function favorites(){
		$this->display();
	}
	#关注
	public function attention(){
		$this->display();
	}
	#获取登录验证码
	public function verify(){
		$type = isset ( $_GET ['type'] ) ? $_GET ['type'] : 'gif';
		import("@.ORG.Image" );
		Image::buildImageVerify ( 4, 1, $type,48,35 );
	}
}